package com.lpl.mapper;

import com.lpl.polo.conter;
import com.lpl.polo.user;
import com.lpl.polo.xaing;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface Xaingma {
    //    插入论坛数据
    @Insert("INSERT INTO lun (id, title, content, logo, name, time, luncol) " +
            "VALUES (#{id}, #{title}, #{content}, #{logo}, #{name}, #{time}, NULL)")
    void insLun(xaing lunxaing);

    //    查找论坛数据
    @Select("SELECT * FROM lun " +
            "ORDER BY STR_TO_DATE(time, '%Y-%m-%d %H:%i:%s') DESC")
    List<xaing> getLun();
//插入评论
@Insert("INSERT INTO conter (id, title, logo, name, time, text,lunid) " +
        "VALUES (#{id}, null, #{logo}, #{name}, #{time}, #{title},#{lunid})")
    void tixiang( conter conter);
//查找对应的评论
    @Select("SELECT * FROM conter WHERE lunid = #{id} " +
            "ORDER BY STR_TO_DATE(time, '%Y-%m-%d %H:%i:%s') DESC")
    List<conter> getLunx(int id);
}


